<!--
// +----------------------------------------------------------------------
// | Copyright (c) 2017 https://gitee.com/honoryao All rights reserved.
// +----------------------------------------------------------------------
// | Author: honoryao <2463523099@qq.com>
// +----------------------------------------------------------------------
// | Time: 2018/6/8   
// +----------------------------------------------------------------------
-->
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>v-on事件监听</title>
</head>
<body>
<h1>v-on事件监听</h1>
<hr>
<div id="app">
    本场比赛得分： <span v-text="count"></span><br/>
    <button v-on:click="jiafen">加分</button>
    <button v-on:click="jianfen">减分</button>
    <input type="text" v-on:keyup.enter="onEnter" v-model="secondCount">
</div>

<script src="../assets/js/vue.js"></script>
<script>
    var app= new Vue({
        el:'#app',
        data:{
            count:1,
            secondCount:2
        },
        methods:{
            jiafen:function(){
                this.count++;
            },
            jianfen:function(){
                this.count--;
            },
            onEnter:function(){
                this.count=this.count+parseInt(this.secondCount);
            }
        }
    });
</script>
</body>
</html>